<!DOCTYPE html>
<html>
<head>
    <title>益多多回收商入驻</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="${s.base}/mobile/css/weui.min.css">
    <link rel="stylesheet" href="${s.base}/mobile/css/jquery-weui.min.css">
    <link rel="stylesheet" href="${s.base}/mobile/css/base.css">
    <link rel="stylesheet" href="${s.base}/mobile/css/component.css">
    <style type="text/css">
		body,html{background: #e4e4e4;}
        .icon_8a {
            width: 1.5em; height: 1.5em;
            vertical-align: -0.15em;
            fill: #8A8A8A;
            overflow: hidden;
        }
    </style>
</head>
<!-- 回收商圈入驻 -->
<body>
<input type="hidden" value="${latlong}" id="latlong"/>
<div style="width:100%;height:auto;"><img src="/mobile/images/banner.jpg"></div>
<div class="xyg-comp-form">
       <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
             公司名称
            </div>
            <div class="xyg-comp-form-item-content">
             <input type="text" id="companyName" placeholder="请先填写公司名称" />
            </div>
            <div class="clearBoth"></div>
       </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                联系人
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="text" id="name" placeholder="请先填写联系人" />
            </div>
            <div class="clearBoth"></div>
        </div>
        <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title"> 
             联系电话
            </div>
            <div class="xyg-comp-form-item-content"> 
             <input type="text" id="phone" placeholder="请先填写联系电话" />
            </div>
            <div class="clearBoth"></div>
       </div>
		<div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title">
                所在区域
            </div>
            <div class="xyg-comp-form-item-content">
                <input type="text" id="area" value="${webAddress.area}" data-values="${webAddress.id}" placeholder="请先选择所在区域" />
            </div>
            <div class="clearBoth"></div>
        </div>
       <div class="xyg-comp-form-item-one">
            <div class="xyg-comp-form-item-title"> 
             所在地址
            </div>
            <div class="xyg-comp-form-item-content"> 
             <input type="text" id="address" placeholder="请先填写上门地址" style=" width:420px;" />
                <span data-id="address" class="acceptAddress" style="width: 50px; text-align: right; float: right;">
                    <svg class="icon_8a" aria-hidden="true">
                        <use xlink:href="#icondizhi1"></use>
                    </svg>
                </span>
            </div>
            <div class="clearBoth"></div>
       </div>
      <div class="xyg-comp-form-item">
             <div class="xyg-comp-form-item-textarea-content"> 
             <textarea class="fontStyle1" id="businessScope" placeholder="请描述回收范围，上传营业执照" ></textarea>
            </div>
            <div class="xyg-comp-form-item-upload"> 
                <div class="xyg-comp-form-item-upload-pic" id="uploaderFiles" data-objectId="">
                	<!--<img src="${s.base}/mobile/images/ewm.png"/>
                    <img src="${s.base}/mobile/images/ewm.png"/>
                    <img src="${s.base}/mobile/images/ewm.png"/>-->
                </div>
                <div class="xyg-comp-form-item-upload-btn"> 
                	<img src="${s.base}/mobile/images/icon_upload.png"/>
                    <div class="upload-title">照片</div>
                    <input id="file" name="file" class="weui-uploader__input" type="file" accept="image/*" multiple onchange="cytImgUpload('file','','uploaderFiles',9,2)">
                </div>
                <div class="clearBoth"></div>
            </div>
       </div> 
       <!--<div class="xyg-comp-form-tip">
             <input id="checkContract" type="checkbox"/>统一《环保协议》的所得税法水电费水电费水电费是否对
       </div> -->
       <input type="button" id="save" class="xyg-btn-one color-bs margin-top-1rem" value="提交"/>
  	</div>
</body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<script src="${s.base}/mobile/js/jquery-2.1.4.js"></script>
<script src="${s.base}/mobile/js/jquery-weui.js"></script>
<script src="${s.base}/mobile/fonts/iconfont.js"></script>
<script src="${s.base}/mobile/js/component.js?1216334345454345562"></script>
<script src="${s.base}/mobile/js/base.js?1216334345454345562"></script>
<script src="${s.base}/mobile/js/ajaxfileupload.js"></script>

<!--js分享代码开始-->
<input type="hidden" value="${jSTicketShareResponse.appid}" id="appid" />
<input type="hidden" value="${jSTicketShareResponse.fxTitle}" id="fxTitle" />
<input type="hidden" value="${jSTicketShareResponse.fxImgUrl}" id="fxImgUrl" />
<input type="hidden" value="${jSTicketShareResponse.fxDesc}" id="fxDesc" />
<input type="hidden" value="${jSTicketShareResponse.fxUrl}" id="fxUrl" />
<input type="hidden" value="${jSTicketShareResponse.nonceStr}" id="nonceStr" />
<input type="hidden" value="${jSTicketShareResponse.timestamp}" id="timestamp" />
<input type="hidden" value="${jSTicketShareResponse.signature}" id="signature" />
<script src="${s.base}/mobile/js/share.js?1216334345454345562"></script>
<script type="text/javascript">
    var memberId = '${memberId}';


    // 所在区域
    var items=[];
    $.ajax({
        type:"post",
        url:"/phone/webAddressJsonList",
        data:"",
        async:false,
        success:function (data) {
            if(data.code=="0"){
                var webAddressList = data.data;
                if(webAddressList != null && webAddressList.length > 0){
                    for (var i=0;i<webAddressList.length;i++){
                        var webAddress=webAddressList[i];
                        var obj={};
                        obj.title=webAddress.area;
                        obj.value = webAddress.id;
                        items.push(obj);
                    }
                }else{
                    // $("#show").show();
                    return false;
                }
            }else{
                layer.msg(data.msg);
            }
        }
    })
    $("#area").select({
        title: "请选择",
        // multi: true,
        min: 2,
        max: 3,
        items: items,
        onChange: function(d) {
            //console.log(this, d);
            //initClass();
        },
        onClose: function (d) {
            //console.log(d);
            //console.log('close')
        },
        onClick: function (d) {
            //console.log(1)
        }
    });

    $("#save").on("click", function () {
        /*if($('#checkContract').is(':checked') == false) {
            $.toast("请同意环保协议", "text");
            return false;
        }*/
        var area = $("#area").attr("data-values");
        console.log(area);
        var companyName = $("#companyName").val();
        if (companyName == null || companyName == "") {
            $.toast("请先填写公司姓名", "text");
            return false;
        }
        var name = $("#name").val();
        if (name == null || name == "") {
            $.toast("请先填写联系人", "text");
            return false;
        }
        var phone = $("#phone").val();
        if (phone == null || phone == "") {
            $.toast("请先填写联系电话", "text");
            return false;
        }
        if (!(/^1(3|4|5|7|8)\d{9}$/.test(phone))) {
            $.toast("手机号码有误，请重填", "text");
            return false;
        }
        // 上门地址
        var address = $("#address").val();
        if (address == null || address == "") {
            $.toast("请先填写上门地址", "text");
            return false;
        }
        var businessScope = $("#businessScope").val();
        if (businessScope == null || businessScope == "") {
            $.toast("请描述回收范围", "text");
            return false;
        }
        // 图片
        var imageArr = [];
        $("#uploaderFiles img").each(function () {
            var image = $(this).attr("src");
            imageArr.push(image)
        });
        var param = {
            companyName: companyName,
            name: name,
            memberId: memberId,
            phone: phone,
            area: area,
            address: address,
            businessScope: businessScope,
            status: '1',
            image: imageArr.join(",")
        };
        $.showLoading("正在提交中");
        $.post("/phone/recoveryCircleSave", param, function (result) {
            if (0 == result.code) {
                $.hideLoading();
                $.alert("提交成功",function () {
                    goHssqPage(memberId);
                });
            } else {
                $.hideLoading();
                $.alert(result.msg);
            }
        }, "json");
    });
</script>
</html>
